package com.stox.ui.swing.launcher;

import java.io.File;
import java.io.FilenameFilter;
import java.net.URL;
import java.net.URLClassLoader;

public class StoxClassLoader extends URLClassLoader {

	private static URL[] urls;
	
	static{
		try{
			File library = new File(new URL("file:\\"+System.getProperty("path.library")).toURI());
			File[] jars = library.listFiles(new FilenameFilter(){
				@Override
				public boolean accept(File dir, String name) {
					return name.endsWith("jar");
				}
			});
			urls = new URL[jars.length];
			for(int i = 0; i < jars.length; i++){
				urls[i] = jars[i].toURI().toURL();
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	public StoxClassLoader() {
		super(urls);
	}
	
}
